home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / distutils / sysconfig.py < prev    next >
Encoding:
Python Source  |  2009-04-18  |  21.3 KB  |  586 lines

  1. """Provide access to Python's configuration information.  The specific
  2. configuration variables available depend heavily on the platform and
  3. configuration.  The values may be retrieved using
  4. get_config_var(name), and the list of variables is available via
  5. get_config_vars().keys().  Additional convenience functions are also
  6. available.
  7.  
  8. Written by:   Fred L. Drake, Jr.
  9. Email:        <fdrake@acm.org>
  10. """
  11.  
  12. __revision__ = "$Id: sysconfig.py 69486 2009-02-10 12:33:42Z tarek.ziade $"
  13.  
  14. import os
  15. import re
  16. import string
  17. import sys
  18.  
  19. from distutils.errors import DistutilsPlatformError
  20.  
  21. # These are needed in a couple of spots, so just compute them once.
  22. PREFIX = os.path.normpath(sys.prefix)
  23. EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
  24.  
  25. # Path to the base directory of the project. On Windows the binary may
  26. # live in project/PCBuild9.  If we're dealing with an x64 Windows build,
  27. # it'll live in project/PCbuild/amd64.
  28. project_base = os.path.dirname(os.path.abspath(sys.executable))
  29. if os.name == "nt" and "pcbuild" in project_base[-8:].lower():
  30.     project_base = os.path.abspath(os.path.join(project_base, os.path.pardir))
  31. # PC/VS7.1
  32. if os.name == "nt" and "\\pc\\v" in project_base[-10:].lower():
  33.     project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
  34.                                                 os.path.pardir))
  35. # PC/AMD64
  36. if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower():
  37.     project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
  38.                                                 os.path.pardir))
  39.  
  40. # python_build: (Boolean) if true, we're either building Python or
  41. # building an extension with an un-installed Python, so we use
  42. # different (hard-wired) directories.
  43. # Setup.local is available for Makefile builds including VPATH builds,
  44. # Setup.dist is available on Windows
  45. def _python_build():
  46.     for fn in ("Setup.dist", "Setup.local"):
  47.         if os.path.isfile(os.path.join(project_base, "Modules", fn)):
  48.             return True
  49.     return False
  50. python_build = _python_build()
  51.  
  52.  
  53. def get_python_version():
  54.     """Return a string containing the major and minor Python version,
  55.     leaving off the patchlevel.  Sample return values could be '1.5'
  56.     or '2.2'.
  57.     """
  58.     return sys.version[:3]
  59.  
  60.  
  61. def get_python_inc(plat_specific=0, prefix=None):
  62.     """Return the directory containing installed Python header files.
  63.  
  64.     If 'plat_specific' is false (the default), this is the path to the
  65.     non-platform-specific header files, i.e. Python.h and so on;
  66.     otherwise, this is the path to platform-specific header files
  67.     (namely pyconfig.h).
  68.  
  69.     If 'prefix' is supplied, use it instead of sys.prefix or
  70.     sys.exec_prefix -- i.e., ignore 'plat_specific'.
  71.     """
  72.     if prefix is None:
  73.         prefix = plat_specific and EXEC_PREFIX or PREFIX
  74.     if os.name == "posix":
  75.         if python_build:
  76.             base = os.path.dirname(os.path.abspath(sys.executable))
  77.             if plat_specific:
  78.                 inc_dir = base
  79.             else:
  80.                 inc_dir = os.path.join(base, "Include")
  81.                 if not os.path.exists(inc_dir):
  82.                     inc_dir = os.path.join(os.path.dirname(base), "Include")
  83.             return inc_dir
  84.         return os.path.join(prefix, "include",
  85.                             "python" + get_python_version() + (sys.pydebug and '_d' or ''))
  86.     elif os.name == "nt":
  87.         return os.path.join(prefix, "include")
  88.     elif os.name == "mac":
  89.         if plat_specific:
  90.             return os.path.join(prefix, "Mac", "Include")
  91.         else:
  92.             return os.path.join(prefix, "Include")
  93.     elif os.name == "os2":
  94.         return os.path.join(prefix, "Include")
  95.     else:
  96.         raise DistutilsPlatformError(
  97.             "I don't know where Python installs its C header files "
  98.             "on platform '%s'" % os.name)
  99.  
  100.  
  101. def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
  102.     """Return the directory containing the Python library (standard or
  103.     site additions).
  104.  
  105.     If 'plat_specific' is true, return the directory containing
  106.     platform-specific modules, i.e. any module from a non-pure-Python
  107.     module distribution; otherwise, return the platform-shared library
  108.     directory.  If 'standard_lib' is true, return the directory
  109.     containing standard Python library modules; otherwise, return the
  110.     directory for site-specific modules.
  111.  
  112.     If 'prefix' is supplied, use it instead of sys.prefix or
  113.     sys.exec_prefix -- i.e., ignore 'plat_specific'.
  114.     """
  115.     is_default_prefix = not prefix or os.path.normpath(prefix) in ('/usr', '/usr/local')
  116.     if prefix is None:
  117.         prefix = plat_specific and EXEC_PREFIX or PREFIX
  118.  
  119.     if os.name == "posix":
  120.         libpython = os.path.join(prefix,
  121.                                  "lib", "python" + get_python_version())
  122.         if standard_lib:
  123.             return libpython
  124.         elif is_default_prefix and 'PYTHONUSERBASE' not in os.environ and 'real_prefix' not in sys.__dict__:
  125.             return os.path.join(libpython, "dist-packages")
  126.         else:
  127.             return os.path.join(libpython, "site-packages")
  128.  
  129.     elif os.name == "nt":
  130.         if standard_lib:
  131.             return os.path.join(prefix, "Lib")
  132.         else:
  133.             if get_python_version() < "2.2":
  134.                 return prefix
  135.             else:
  136.                 return os.path.join(prefix, "Lib", "site-packages")
  137.  
  138.     elif os.name == "mac":
  139.         if plat_specific:
  140.             if standard_lib:
  141.                 return os.path.join(prefix, "Lib", "lib-dynload")
  142.             else:
  143.                 return os.path.join(prefix, "Lib", "site-packages")
  144.         else:
  145.             if standard_lib:
  146.                 return os.path.join(prefix, "Lib")
  147.             else:
  148.                 return os.path.join(prefix, "Lib", "site-packages")
  149.  
  150.     elif os.name == "os2":
  151.         if standard_lib:
  152.             return os.path.join(prefix, "Lib")
  153.         else:
  154.             return os.path.join(prefix, "Lib", "site-packages")
  155.  
  156.     else:
  157.         raise DistutilsPlatformError(
  158.             "I don't know where Python installs its library "
  159.             "on platform '%s'" % os.name)
  160.  
  161.  
  162. def customize_compiler(compiler):
  163.     """Do any platform-specific customization of a CCompiler instance.
  164.  
  165.     Mainly needed on Unix, so we can plug in the information that
  166.     varies across Unices and is stored in Python's Makefile.
  167.     """
  168.     if compiler.compiler_type == "unix":
  169.         (cc, cxx, opt, cflags, opt, extra_cflags, basecflags, ccshared, ldshared, so_ext) = \
  170.             get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
  171.                             'OPT', 'EXTRA_CFLAGS', 'BASECFLAGS',
  172.                             'CCSHARED', 'LDSHARED', 'SO')
  173.  
  174.         if 'CC' in os.environ:
  175.             cc = os.environ['CC']
  176.         if 'CXX' in os.environ:
  177.             cxx = os.environ['CXX']
  178.         if 'LDSHARED' in os.environ:
  179.             ldshared = os.environ['LDSHARED']
  180.         if 'CPP' in os.environ:
  181.             cpp = os.environ['CPP']
  182.         else:
  183.             cpp = cc + " -E"           # not always
  184.         if 'LDFLAGS' in os.environ:
  185.             ldshared = ldshared + ' ' + os.environ['LDFLAGS']
  186.         if 'BASECFLAGS' in os.environ:
  187.             basecflags = os.environ['BASECFLAGS']
  188.         if 'OPT' in os.environ:
  189.             opt = os.environ['OPT']
  190.         cflags = ' '.join(str(x) for x in (basecflags, opt, extra_cflags) if x)
  191.         if 'CFLAGS' in os.environ:
  192.             cflags = ' '.join(str(x) for x in (basecflags, opt, os.environ['CFLAGS'], extra_cflags) if x)
  193.             ldshared = ldshared + ' ' + os.environ['CFLAGS']
  194.         if 'CPPFLAGS' in os.environ:
  195.             cpp = cpp + ' ' + os.environ['CPPFLAGS']
  196.             cflags = cflags + ' ' + os.environ['CPPFLAGS']
  197.             ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
  198.  
  199.         cc_cmd = cc + ' ' + cflags
  200.         compiler.set_executables(
  201.             preprocessor=cpp,
  202.             compiler=cc_cmd,
  203.             compiler_so=cc_cmd + ' ' + ccshared,
  204.             compiler_cxx=cxx,
  205.             linker_so=ldshared,
  206.             linker_exe=cc)
  207.  
  208.         compiler.shared_lib_extension = so_ext
  209.  
  210.  
  211. def get_config_h_filename():
  212.     """Return full pathname of installed pyconfig.h file."""
  213.     if python_build:
  214.         if os.name == "nt":
  215.             inc_dir = os.path.join(project_base, "PC")
  216.         else:
  217.             inc_dir = project_base
  218.     else:
  219.         inc_dir = get_python_inc(plat_specific=1)
  220.     if get_python_version() < '2.2':
  221.         config_h = 'config.h'
  222.     else:
  223.         # The name of the config.h file changed in 2.2
  224.         config_h = 'pyconfig.h'
  225.     return os.path.join(inc_dir, config_h)
  226.  
  227.  
  228. def get_makefile_filename():
  229.     """Return full pathname of installed Makefile from the Python build."""
  230.     if python_build:
  231.         return os.path.join(os.path.dirname(sys.executable), "Makefile")
  232.     lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
  233.     return os.path.join(lib_dir, "config" + (sys.pydebug and "_d" or ""), "Makefile")
  234.  
  235.  
  236. def parse_config_h(fp, g=None):
  237.     """Parse a config.h-style file.
  238.  
  239.     A dictionary containing name/value pairs is returned.  If an
  240.     optional dictionary is passed in as the second argument, it is
  241.     used instead of a new dictionary.
  242.     """
  243.     if g is None:
  244.         g = {}
  245.     define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
  246.     undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
  247.     #
  248.     while 1:
  249.         line = fp.readline()
  250.         if not line:
  251.             break
  252.         m = define_rx.match(line)
  253.         if m:
  254.             n, v = m.group(1, 2)
  255.             try: v = int(v)
  256.             except ValueError: pass
  257.             g[n] = v
  258.         else:
  259.             m = undef_rx.match(line)
  260.             if m:
  261.                 g[m.group(1)] = 0
  262.     return g
  263.  
  264.  
  265. # Regexes needed for parsing Makefile (and similar syntaxes,
  266. # like old-style Setup files).
  267. _variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
  268. _findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
  269. _findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
  270.  
  271. def parse_makefile(fn, g=None):
  272.     """Parse a Makefile-style file.
  273.  
  274.     A dictionary containing name/value pairs is returned.  If an
  275.     optional dictionary is passed in as the second argument, it is
  276.     used instead of a new dictionary.
  277.     """
  278.     from distutils.text_file import TextFile
  279.     fp = TextFile(fn, strip_comments=1, skip_blanks=1, join_lines=1)
  280.  
  281.     if g is None:
  282.         g = {}
  283.     done = {}
  284.     notdone = {}
  285.  
  286.     while 1:
  287.         line = fp.readline()
  288.         if line is None:                # eof
  289.             break
  290.         m = _variable_rx.match(line)
  291.         if m:
  292.             n, v = m.group(1, 2)
  293.             v = string.strip(v)
  294.             if "$" in v:
  295.                 notdone[n] = v
  296.             else:
  297.                 try: v = int(v)
  298.                 except ValueError: pass
  299.                 done[n] = v
  300.  
  301.     # do variable interpolation here
  302.     while notdone:
  303.         for name in notdone.keys():
  304.             value = notdone[name]
  305.             m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
  306.             if m:
  307.                 n = m.group(1)
  308.                 found = True
  309.                 if n in done:
  310.                     item = str(done[n])
  311.                 elif n in notdone:
  312.                     # get it on a subsequent round
  313.                     found = False
  314.                 elif n in os.environ:
  315.                     # do it like make: fall back to environment
  316.                     item = os.environ[n]
  317.                 else:
  318.                     done[n] = item = ""
  319.                 if found:
  320.                     after = value[m.end():]
  321.                     value = value[:m.start()] + item + after
  322.                     if "$" in after:
  323.                         notdone[name] = value
  324.                     else:
  325.                         try: value = int(value)
  326.                         except ValueError:
  327.                             done[name] = string.strip(value)
  328.                         else:
  329.                             done[name] = value
  330.                         del notdone[name]
  331.             else:
  332.                 # bogus variable reference; just drop it since we can't deal
  333.                 del notdone[name]
  334.  
  335.     fp.close()
  336.  
  337.     # save the results in the global dictionary
  338.     g.update(done)
  339.     return g
  340.  
  341.  
  342. def expand_makefile_vars(s, vars):
  343.     """Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in
  344.     'string' according to 'vars' (a dictionary mapping variable names to
  345.     values).  Variables not present in 'vars' are silently expanded to the
  346.     empty string.  The variable values in 'vars' should not contain further
  347.     variable expansions; if 'vars' is the output of 'parse_makefile()',
  348.     you're fine.  Returns a variable-expanded version of 's'.
  349.     """
  350.  
  351.     # This algorithm does multiple expansion, so if vars['foo'] contains
  352.     # "${bar}", it will expand ${foo} to ${bar}, and then expand
  353.     # ${bar}... and so forth.  This is fine as long as 'vars' comes from
  354.     # 'parse_makefile()', which takes care of such expansions eagerly,
  355.     # according to make's variable expansion semantics.
  356.  
  357.     while 1:
  358.         m = _findvar1_rx.search(s) or _findvar2_rx.search(s)
  359.         if m:
  360.             (beg, end) = m.span()
  361.             s = s[0:beg] + vars.get(m.group(1)) + s[end:]
  362.         else:
  363.             break
  364.     return s
  365.  
  366.  
  367. _config_vars = None
  368.  
  369. def _init_posix():
  370.     """Initialize the module as appropriate for POSIX systems."""
  371.     g = {}
  372.     # load the installed Makefile:
  373.     try:
  374.         filename = get_makefile_filename()
  375.         parse_makefile(filename, g)
  376.     except IOError, msg:
  377.         my_msg = "invalid Python installation: unable to open %s" % filename
  378.         if hasattr(msg, "strerror"):
  379.             my_msg = my_msg + " (%s)" % msg.strerror
  380.  
  381.         raise DistutilsPlatformError(my_msg)
  382.  
  383.     # load the installed pyconfig.h:
  384.     try:
  385.         filename = get_config_h_filename()
  386.         parse_config_h(file(filename), g)
  387.     except IOError, msg:
  388.         my_msg = "invalid Python installation: unable to open %s" % filename
  389.         if hasattr(msg, "strerror"):
  390.             my_msg = my_msg + " (%s)" % msg.strerror
  391.  
  392.         raise DistutilsPlatformError(my_msg)
  393.  
  394.     # On MacOSX we need to check the setting of the environment variable
  395.     # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
  396.     # it needs to be compatible.
  397.     # If it isn't set we set it to the configure-time value
  398.     if sys.platform == 'darwin' and 'MACOSX_DEPLOYMENT_TARGET' in g:
  399.         cfg_target = g['MACOSX_DEPLOYMENT_TARGET']
  400.         cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '')
  401.         if cur_target == '':
  402.             cur_target = cfg_target
  403.             os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target)
  404.         elif map(int, cfg_target.split('.')) > map(int, cur_target.split('.')):
  405.             my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure'
  406.                 % (cur_target, cfg_target))
  407.             raise DistutilsPlatformError(my_msg)
  408.  
  409.     # On AIX, there are wrong paths to the linker scripts in the Makefile
  410.     # -- these paths are relative to the Python source, but when installed
  411.     # the scripts are in another directory.
  412.     if python_build:
  413.         g['LDSHARED'] = g['BLDSHARED']
  414.  
  415.     elif get_python_version() < '2.1':
  416.         # The following two branches are for 1.5.2 compatibility.
  417.         if sys.platform == 'aix4':          # what about AIX 3.x ?
  418.             # Linker script is in the config directory, not in Modules as the
  419.             # Makefile says.
  420.             python_lib = get_python_lib(standard_lib=1)
  421.             ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix')
  422.             python_exp = os.path.join(python_lib, 'config', 'python.exp')
  423.  
  424.             g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
  425.  
  426.         elif sys.platform == 'beos':
  427.             # Linker script is in the config directory.  In the Makefile it is
  428.             # relative to the srcdir, which after installation no longer makes
  429.             # sense.
  430.             python_lib = get_python_lib(standard_lib=1)
  431.             linkerscript_path = string.split(g['LDSHARED'])[0]
  432.             linkerscript_name = os.path.basename(linkerscript_path)
  433.             linkerscript = os.path.join(python_lib, 'config',
  434.                                         linkerscript_name)
  435.  
  436.             # XXX this isn't the right place to do this: adding the Python
  437.             # library to the link, if needed, should be in the "build_ext"
  438.             # command.  (It's also needed for non-MS compilers on Windows, and
  439.             # it's taken care of for them by the 'build_ext.get_libraries()'
  440.             # method.)
  441.             g['LDSHARED'] = ("%s -L%s/lib -lpython%s" %
  442.                              (linkerscript, PREFIX, get_python_version()))
  443.  
  444.     global _config_vars
  445.     _config_vars = g
  446.  
  447.  
  448. def _init_nt():
  449.     """Initialize the module as appropriate for NT"""
  450.     g = {}
  451.     # set basic install directories
  452.     g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
  453.     g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
  454.  
  455.     # XXX hmmm.. a normal install puts include files here
  456.     g['INCLUDEPY'] = get_python_inc(plat_specific=0)
  457.  
  458.     g['SO'] = '.pyd'
  459.     g['EXE'] = ".exe"
  460.     g['VERSION'] = get_python_version().replace(".", "")
  461.     g['BINDIR'] = os.path.dirname(os.path.abspath(sys.executable))
  462.  
  463.     global _config_vars
  464.     _config_vars = g
  465.  
  466.  
  467. def _init_mac():
  468.     """Initialize the module as appropriate for Macintosh systems"""
  469.     g = {}
  470.     # set basic install directories
  471.     g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
  472.     g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
  473.  
  474.     # XXX hmmm.. a normal install puts include files here
  475.     g['INCLUDEPY'] = get_python_inc(plat_specific=0)
  476.  
  477.     import MacOS
  478.     if not hasattr(MacOS, 'runtimemodel'):
  479.         g['SO'] = '.ppc.slb'
  480.     else:
  481.         g['SO'] = '.%s.slb' % MacOS.runtimemodel
  482.  
  483.     # XXX are these used anywhere?
  484.     g['install_lib'] = os.path.join(EXEC_PREFIX, "Lib")
  485.     g['install_platlib'] = os.path.join(EXEC_PREFIX, "Mac", "Lib")
  486.  
  487.     # These are used by the extension module build
  488.     g['srcdir'] = ':'
  489.     global _config_vars
  490.     _config_vars = g
  491.  
  492.  
  493. def _init_os2():
  494.     """Initialize the module as appropriate for OS/2"""
  495.     g = {}
  496.     # set basic install directories
  497.     g['LIBDEST'] = get_python_lib(plat_specific=0, standard_lib=1)
  498.     g['BINLIBDEST'] = get_python_lib(plat_specific=1, standard_lib=1)
  499.  
  500.     # XXX hmmm.. a normal install puts include files here
  501.     g['INCLUDEPY'] = get_python_inc(plat_specific=0)
  502.  
  503.     g['SO'] = '.pyd'
  504.     g['EXE'] = ".exe"
  505.  
  506.     global _config_vars
  507.     _config_vars = g
  508.  
  509.  
  510. def get_config_vars(*args):
  511.     """With no arguments, return a dictionary of all configuration
  512.     variables relevant for the current platform.  Generally this includes
  513.     everything needed to build extensions and install both pure modules and
  514.     extensions.  On Unix, this means every variable defined in Python's
  515.     installed Makefile; on Windows and Mac OS it's a much smaller set.
  516.  
  517.     With arguments, return a list of values that result from looking up
  518.     each argument in the configuration variable dictionary.
  519.     """
  520.     global _config_vars
  521.     if _config_vars is None:
  522.         func = globals().get("_init_" + os.name)
  523.         if func:
  524.             func()
  525.         else:
  526.             _config_vars = {}
  527.  
  528.         # Normalized versions of prefix and exec_prefix are handy to have;
  529.         # in fact, these are the standard versions used most places in the
  530.         # Distutils.
  531.         _config_vars['prefix'] = PREFIX
  532.         _config_vars['exec_prefix'] = EXEC_PREFIX
  533.  
  534.         if sys.platform == 'darwin':
  535.             kernel_version = os.uname()[2] # Kernel version (8.4.3)
  536.             major_version = int(kernel_version.split('.')[0])
  537.  
  538.             if major_version < 8:
  539.                 # On Mac OS X before 10.4, check if -arch and -isysroot
  540.                 # are in CFLAGS or LDFLAGS and remove them if they are.
  541.                 # This is needed when building extensions on a 10.3 system
  542.                 # using a universal build of python.
  543.                 for key in ('LDFLAGS', 'BASECFLAGS',
  544.                         # a number of derived variables. These need to be
  545.                         # patched up as well.
  546.                         'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
  547.                     flags = _config_vars[key]
  548.                     flags = re.sub('-arch\s+\w+\s', ' ', flags)
  549.                     flags = re.sub('-isysroot [^ \t]*', ' ', flags)
  550.                     _config_vars[key] = flags
  551.  
  552.             else:
  553.  
  554.                 # Allow the user to override the architecture flags using
  555.                 # an environment variable.
  556.                 # NOTE: This name was introduced by Apple in OSX 10.5 and
  557.                 # is used by several scripting languages distributed with
  558.                 # that OS release.
  559.  
  560.                 if 'ARCHFLAGS' in os.environ:
  561.                     arch = os.environ['ARCHFLAGS']
  562.                     for key in ('LDFLAGS', 'BASECFLAGS',
  563.                         # a number of derived variables. These need to be
  564.                         # patched up as well.
  565.                         'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
  566.  
  567.                         flags = _config_vars[key]
  568.                         flags = re.sub('-arch\s+\w+\s', ' ', flags)
  569.                         flags = flags + ' ' + arch
  570.                         _config_vars[key] = flags
  571.  
  572.     if args:
  573.         vals = []
  574.         for name in args:
  575.             vals.append(_config_vars.get(name))
  576.         return vals
  577.     else:
  578.         return _config_vars
  579.  
  580. def get_config_var(name):
  581.     """Return the value of a single variable using the dictionary
  582.     returned by 'get_config_vars()'.  Equivalent to
  583.     get_config_vars().get(name)
  584.     """
  585.     return get_config_vars().get(name)
  586.